/* SGATOR
 * base/types.h
 */

#ifndef SGBASETYPES_H
#define SGBASETYPES_H

#ifdef SGDOUBLE
typedef double SgFloat;
#else
typedef float SgFloat;
#endif
typedef float SgSingle;
typedef double SgDouble;

/* 16 bits integers */
typedef unsigned short SgUShort;
typedef short SgShort;
/* 32 bits integers */
typedef unsigned int SgUInt;
typedef int SgInt;
/* machine's wordsize integers */
typedef unsigned long SgULong;
typedef long SgLong;

typedef char SgChar;

typedef char SgBool;
#define TRUE 1
#define FALSE 0

typedef unsigned int SgSizeT;

#define POINTER_SIZE (sizeof(void*))
#ifndef NULL
#define NULL ((void*)0)
#endif

//typedef long long SgVal;

#define SGVFL(v) ((SgFloat)(v))
#define SGVSF(v) ((SgSingle)(v))
#define SGVDF(v) ((SgDouble)(v))
#define SGVUS(v) ((SgUShort)(v))
#define SGVSS(v) ((SgShort)(v))
#define SGVUI(v) ((SgUInt)(v))
#define SGVSI(v) ((SgInt)(v))
#define SGVUL(v) ((SgULong)(v))
#define SGVSL(v) ((SgULong)(v))
#define SGVBL(v) ((SgBool)(v))
#define SGVST(v) ((SgChar*)(v))

typedef union _SgVal
{
  SgFloat fl;
  SgSingle sf;
  SgDouble df;
  SgUShort us;
  SgShort ss;
  SgUInt ui;
  SgInt si;
  SgULong ul;
  SgLong sl;
  SgBool bl;
  char *st;
  union _SgVal *ot;
} SgVal;

#endif

/* end */

